package com.dk.factory;

import com.dk.action.*;
import com.dk.enumerate.DkRuleEnum;
import com.dk.util.http.req.ReqStrategy;

/**
 * 动作工厂
 */
public class ActionFactory extends AbstractFactory{
    /**
     * 根据动作类型获取动作对象
     * @param actionType 动作类型
     * @return
     */
    @Override
    public ActionStrategy getAction(String actionType) {
        if(actionType == null){
            return null;
        }
        if(actionType.equals(DkRuleEnum.ACTIONTYPE_CASE.getValue())){
            return new ExcuteCaseHandler();
        } else if(actionType.equals(DkRuleEnum.ACTIONTYPE_SQL_SELECT.getValue())){
            return new SqlSelectHandler();
        } else if(actionType.equals(DkRuleEnum.ACTIONTYPE_SQL_INSERT.getValue())){
            return new SqlInsertHandler();
        } else if(actionType.equals(DkRuleEnum.ACTIONTYPE_SQL_UPDATE.getValue())){
            return new SqlUpdateHandler();
        } else if(actionType.equals(DkRuleEnum.ACTIONTYPE_SQL_DELETE.getValue())){
            return new SqlDeleteHandler();
        }else if(actionType.equals(DkRuleEnum.ACTIONTYPE_SQL_WAIT.getValue())){
            return new CaseWait();
        }
        return null;
    }

    @Override
    public ReqStrategy getReq(String method) {
        return null;
    }

}
